package 韩顺平集合.collection;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class p4CollectionIterator迭代器 {
    public static void main(String[] args) {
        List list=new ArrayList();

        list.add(1);
        list.add(2);
        list.add(3);
        list.add(4);

        Iterator iterator = list.iterator();
        while(iterator.hasNext()){
            Object next = iterator.next();
            System.out.println(next);
        }

        //这个是重置迭代器
        Iterator iterator1=list.iterator();
    }
}
